local function FuckGlobalUsingMetatable()
	GLOBAL.setmetatable(
		env,
		{
			__index = function(t, k)
				if k ~= "PrefabFiles" and k ~= "Assets" and k ~= "clothing_exclude" then
					return GLOBAL[k] and GLOBAL[k] or nil
				end
			end
		}
	)
end
FuckGlobalUsingMetatable()

PrefabFiles = {
	"yukikaze",
	"hasya_fx",
	"gyorai_fx",
	"hou_76mm",
	"sekkeizu"
}

Assets = {
	Asset("ATLAS", "images/yukikaze.xml"),
	Asset("ATLAS", "images/yukikaze_skill.xml"),
	Asset("ATLAS", "images/yukikaze_kekon.xml"),
	Asset("ATLAS", "images/yukikaze_kekonshiki.xml"),
	Asset("ATLAS", "images/yukikaze_te.xml"),
	Asset("ANIM", "anim/koukan.zip"),
	Asset("ATLAS", "images/inventoryimages/yukikazetab.xml"),
	Asset("ANIM", "anim/hou_76mm.zip"),
	Asset("ATLAS", "images/inventoryimages/hou_76mm.xml"),
	Asset("IMAGE", "images/inventoryimages/hou_76mm.tex"),
	Asset("ANIM", "anim/sekkeizu.zip"),
	Asset("ATLAS", "images/inventoryimages/sekkeizu.xml"),
	Asset("IMAGE", "images/inventoryimages/sekkeizu.tex"),
	Asset("ANIM", "anim/hasya_fx.zip"),
	Asset("ANIM", "anim/gyorai_fx.zip"),
	Asset("SOUNDPACKAGE", "sound/yukikaze.fev"),
	Asset("SOUND", "sound/yukikaze.fsb"),
	Asset("ANIM", "anim/yukikaze.zip"),
	Asset("ANIM", "anim/ghost_yukikaze_build.zip"),
	Asset("IMAGE", "bigportraits/yukikaze_none.tex"),
	Asset("ATLAS", "bigportraits/yukikaze_none.xml"),
	Asset("IMAGE", "bigportraits/yukikaze.tex"),
	Asset("ATLAS", "bigportraits/yukikaze.xml"),
	Asset("IMAGE", "images/saveslot_portraits/yukikaze.tex"),
	Asset("ATLAS", "images/saveslot_portraits/yukikaze.xml"),
	Asset("IMAGE", "images/selectscreen_portraits/yukikaze.tex"),
	Asset("ATLAS", "images/selectscreen_portraits/yukikaze.xml"),
	Asset("IMAGE", "images/selectscreen_portraits/yukikaze_silho.tex"),
	Asset("ATLAS", "images/selectscreen_portraits/yukikaze_silho.xml"),
	Asset("IMAGE", "images/map_icons/yukikaze.tex"),
	Asset("ATLAS", "images/map_icons/yukikaze.xml"),
	Asset("IMAGE", "images/avatars/avatar_yukikaze.tex"),
	Asset("ATLAS", "images/avatars/avatar_yukikaze.xml"),
	Asset("IMAGE", "images/avatars/avatar_ghost_yukikaze.tex"),
	Asset("ATLAS", "images/avatars/avatar_ghost_yukikaze.xml"),
	Asset("IMAGE", "images/avatars/self_inspect_yukikaze.tex"),
	Asset("ATLAS", "images/avatars/self_inspect_yukikaze.xml")
}
AddMinimapAtlas("images/map_icons/yukikaze.xml")
AddModCharacter("yukikaze", "FEMALE")

yukikazetab =
	AddRecipeTab("Yukikaze", 233, "images/inventoryimages/yukikazetab.xml", "yukikazetab.tex", "yukikaze_skiller")

AddRecipe(
	"sekkeizu",
	{Ingredient("papyrus", 1), Ingredient("bluegem", 1), Ingredient("gears", 2)},
	yukikazetab,
	TECH.NONE,
	nil,
	nil,
	nil,
	nil,
	"yukikaze_skiller",
	"images/inventoryimages/sekkeizu.xml",
	"sekkeizu.tex"
)

AddRecipe(
	"hou_76mm",
	{Ingredient("sekkeizu", 10, "images/inventoryimages/sekkeizu.xml"), Ingredient("nightmarefuel", 10)},
	yukikazetab,
	TECH.NONE,
	nil,
	nil,
	nil,
	nil,
	"yukikaze_skiller",
	"images/inventoryimages/hou_76mm.xml",
	"hou_76mm.tex"
)

if GetModConfigData("gengo") == 0 then
	STRINGS.NAMES.HOU_76MM = "76mm Canon"
	STRINGS.RECIPE_DESC.HOU_76MM = "Other world's things"
	STRINGS.CHARACTERS.GENERIC.DESCRIBE.HOU_76MM = "Damage:10x1"

	STRINGS.NAMES.SEKKEIZU = "Unknown design drawing"
	STRINGS.RECIPE_DESC.SEKKEIZU = "Azur Lane"
	STRINGS.CHARACTERS.GENERIC.DESCRIBE.SEKKEIZU = "Something is written on it"

	STRINGS.CHARACTER_TITLES.yukikaze = "Yukikaze"
	STRINGS.CHARACTER_NAMES.yukikaze = "Yukikaze"
	STRINGS.CHARACTER_DESCRIPTIONS.yukikaze = "......"
	STRINGS.CHARACTER_QUOTES.yukikaze = '"......"'

	STRINGS.NAMES.YUKIKAZE = "Yukikaze"

	TUNING.YUKIKAZEIU = "Exp: "
	TUNING.YUKIKAZEIU1 = "Level: "
	TUNING.YUKIKAZEIU2 = "You can help me if you ask so much ~"
	TUNING.YUKIKAZEIU3 = "Do not thank you"
	TUNING.YUKIKAZEIU4 = "You are the lowest!"
	TUNING.YUKIKAZEIU5 = "What, is this smell!"
	TUNING.YUKIKAZEIU6 = "Garbage!"
	TUNING.YUKIKAZEIU7 = "Full Barrage-Yukikaze"
	TUNING.YUKIKAZEIU8 = "Full Barrage-YukikazeⅡ"
end

if GetModConfigData("gengo") == 1 then
	STRINGS.NAMES.HOU_76MM = "76mm 砲"
	STRINGS.RECIPE_DESC.HOU_76MM = "ほかの世界のもの"
	STRINGS.CHARACTERS.GENERIC.DESCRIBE.HOU_76MM = "威力:10x1"

	STRINGS.NAMES.SEKKEIZU = "知らない設計図"
	STRINGS.RECIPE_DESC.SEKKEIZU = "アズールレーン"
	STRINGS.CHARACTERS.GENERIC.DESCRIBE.SEKKEIZU = "なにか書いている"

	STRINGS.CHARACTER_TITLES.yukikaze = "雪風"
	STRINGS.CHARACTER_NAMES.yukikaze = "雪風"
	STRINGS.CHARACTER_DESCRIPTIONS.yukikaze = "なんでもないのだ！"
	STRINGS.CHARACTER_QUOTES.yukikaze = '"雪風"'

	STRINGS.NAMES.YUKIKAZE = "雪風"

	TUNING.YUKIKAZEIU = "今の経験: "
	TUNING.YUKIKAZEIU1 = "練度: "
	TUNING.YUKIKAZEIU2 = "そんなに頼むんなら助けてあげなくもないのだぞ～"
	TUNING.YUKIKAZEIU3 = "感謝することをしないのだ"
	TUNING.YUKIKAZEIU4 = "あんたは...最低のだ！"
	TUNING.YUKIKAZEIU5 = "なにこれ、臭いのだ！"
	TUNING.YUKIKAZEIU6 = "ごみのだ！"
	TUNING.YUKIKAZEIU7 = "全彈發射-雪風"
	TUNING.YUKIKAZEIU8 = "全彈發射-雪風Ⅱ"
end

if GetModConfigData("gengo") == 2 then
	modimport("chs_stringslist.lua")
end

--[[
私の連絡方法
Syuuen.Sakura@gmail.com
!!私はよくオンラインではありません!!
]]

function SetNetvar(inst, nettab)
	local t = {
		net_shortint = net_shortint,
		net_tinybyte = net_tinybyte,
		net_smallbyte = net_smallbyte,
		net_byte = net_byte,
		net_shortint = net_shortint,
		net_ushortint = net_ushortint,
		net_int = net_int,
		net_uint = net_uint,
		net_float = net_float,
		net_hash = net_hash,
		net_string = net_string,
		net_entity = net_entity,
		net_bytearray = net_bytearray,
		net_smallbytearray = net_smallbytearray
	}
	for k, v in pairs(nettab) do
		if type(v) == "table" then
			inst[k] = t[v[1]](inst.GUID, k, k .. "dirty")
			inst[k]:set(v[2])
		end
	end
end

TUNING.YUKIKAZE_MOVEIMAGE = -1000
TUNING.YUKIKAZE_MOVEIMAGE1 = 150
TUNING.YUKIKAZE_ONKEKON = 0

local yukikaze_skill = require("widgets/yukikaze_skill")
local koukan = require("widgets/koukan")
local kekon = require("widgets/kekon")

local function Addkekon(self)
	if self.owner and self.owner:HasTag("yukikaze_skiller") then
		self.kekon = self.status:AddChild(kekon(self.owner))
	end
end

AddClassPostConstruct("widgets/controls", Addkekon)

local function Addkoukan(self)
	if self.owner and self.owner:HasTag("yukikaze_skiller") then
		self.koukan = self.status:AddChild(koukan(self.owner))
		self.koukan:SetPosition(0, -400, 0)
	end
end

AddClassPostConstruct("widgets/controls", Addkoukan)

TUNING.YUKIKAZE_KEKONTE = 900
TUNING.YUKIKAZE_YOMEYUKIKAZE = 0
local function AddYukikaze_skill(self)
	if self.owner and self.owner:HasTag("yukikaze_skiller") then
		self.yukikaze_skill =
			self.bottom_root:AddChild(
			yukikaze_skill("images/yukikaze_skill.xml", "yukikaze_skill.tex", TUNING.YUKIKAZE_MOVEIMAGE, 40, 0)
		)
		self.yukikaze_kekonshiki =
			self.bottom_root:AddChild(
			yukikaze_skill("images/yukikaze_kekonshiki.xml", "yukikaze_kekonshiki.tex", -1920, -1920, 0)
		)
		self.yukikaze_te =
			self.bottom_root:AddChild(yukikaze_skill("images/yukikaze_te.xml", "yukikaze_te.tex", -1920, -1920, 0))
		self.yukikazeimg = self.bottom_root:AddChild(yukikaze_skill("images/yukikaze.xml", "yukikaze.tex", -1920, -1920, 0))
		local old_OnUpdate = self.OnUpdate
		self.OnUpdate = function(self, dt)
			old_OnUpdate(self, dt)
			self.yukikaze_skill:SetPosition(TUNING.YUKIKAZE_MOVEIMAGE, 40, 0)

			self.yukikazeimg:SetPosition(0, 450, 0)
			self.yukikazeimg:SetTint(
				TUNING.YUKIKAZE_YOMEYUKIKAZE,
				TUNING.YUKIKAZE_YOMEYUKIKAZE,
				TUNING.YUKIKAZE_YOMEYUKIKAZE,
				TUNING.YUKIKAZE_YOMEYUKIKAZE
			)

			if TUNING.KEKONSHOW == 1 then
				self.yukikaze_kekonshiki:SetPosition(0, 450, 0)
				if TUNING.YUKIKAZE_YOMEYUKIKAZE < 1 then
					TUNING.YUKIKAZE_YOMEYUKIKAZE = TUNING.YUKIKAZE_YOMEYUKIKAZE + .007
				end

				ThePlayer:DoTaskInTime(
					5,
					function()
						TUNING.YUKIKAZE_YOMEYUKIKAZE = 0
						TUNING.YUKIKAZE_ONKEKONTE = 1
					end
				)
				if TUNING.YUKIKAZE_ONKEKONTE == 1 then
					self.yukikaze_te:SetPosition(0, TUNING.YUKIKAZE_KEKONTE, 0)
				end

				ThePlayer:DoTaskInTime(
					15,
					function()
						TUNING.KEKONSHOW = 0
					end
				)
			else
				self.yukikaze_kekonshiki:SetPosition(-1920, -1920, 0)
				self.yukikaze_te:SetPosition(-1920, -1920, 0)
				self.yukikazeimg:SetPosition(-1920, -1920, 0)
			end
		end
	end
end

AddClassPostConstruct("widgets/controls", AddYukikaze_skill)

STRINGS.CHARACTERS.YUKIKAZE = require "speech_willow"
